package com.soft.user;

import com.soft.dao.TUserDao;
import com.soft.entity.TUser;
import com.soft.entity.User;
import org.junit.jupiter.api.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;

import java.sql.SQLException;

@SpringBootTest
@RunWith(SpringRunner.class)
public class testTUserDao {
    @Autowired
     TUserDao tUserDao;
    @Test
    void test(){
        String a = tUserDao.test(1);
        System.out.println("username==="+a);
    }
    @Test
    void testQueryByNname() throws SQLException {
        TUser user = tUserDao.queryByName("gyx");
        System.out.println(user.toString());
    }
    @Test
    void testQueryById() throws SQLException {
        TUser user = tUserDao.queryById(4);
        System.out.println(user.toString());
    }
    @Test
    void testInsertTUser() throws SQLException {
        TUser user = new TUser();
        user.setPassword("123");
        user.setUsername("zzc");

        int number = tUserDao.insert(user);
        System.out.println("影响了"+number);
    }
    @Test
    void testFindAll(){
        System.out.println(tUserDao.findAll());
    }
}
